package com.xjcs.notetools.base

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.viewbinding.ViewBinding
import com.blankj.utilcode.util.BarUtils

abstract class BaseMvvmActivity<VB: ViewBinding>: AppCompatActivity() {

    protected lateinit var binding : VB
    var lightMode = true

    override fun onCreate(savedInstanceState: Bundle?) {
        if(isTransparentStatusBar()){
            BarUtils.transparentStatusBar(this)
        }
        super.onCreate(savedInstanceState)
        binding = getViewBinding()
        setContentView(binding.root)
        init(savedInstanceState)
        //设置 statusBar默认模式  可在init()过程中修改 ${lightMode} 参数
        BarUtils.setStatusBarLightMode(this, lightMode)

        BarUtils.setNavBarVisibility(this, false)
    }

    //初始化开始
    abstract fun init(savedInstanceState: Bundle?)

    abstract fun getViewBinding(): VB

    open fun isTransparentStatusBar(): Boolean {
        return true
    }

}